package org.example.erp.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 库存管理表
 * @TableName inventory
 */
@TableName(value ="inventory")
@Data
public class Inventory implements Serializable {
    /**
     * 产品物料编号
     */
    @TableId(type = IdType.AUTO)
    private Integer materialProductId;

    /**
     * 产品物料编码
     */
    private String materialProductCode;

    /**
     * 产品物料名称
     */
    private String materialProductName;

    /**
     * 规格型号
     */
    private String specificationAndModel;

    /**
     * 在库数量
     */
    private Integer inventoryQuantity;

    /**
     * 单位
     */
    private String unitId;

    /**
     * 单位名称
     */
    @TableField(exist = false)
    private String unitName;

    /**
     * 入库批次号
     */
    private String inboundBatchNumber;

    /**
     * 仓库
     */
    private String warehouseCode;

    /**
     * 库区
     */
    private String warehouseAreaCode;

    /**
     * 库位
     */
    private String warehouseLocationCode;

    /**
     * 供应商编码
     */
    private String supplierCode;

    /**
     * 供应商名称
     */
    private String supplierName;

    /**
     * 供应商简称
     */
    private String supplierAbbreviation;

    /**
     * 生产工单
     */
    private String productionOrder;

    /**
     * 入库日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date indate;

    /**
     * 库存有效期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date validityPeriodOfInventory;


    @TableField(exist = false)
    private String warehouseName;

    private String warehouseAreaName;

    private String warehouseLocationName;


    @TableField(exist = false)
    private Integer lineId;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @TableField(exist = false)
    private List<Warehouse> warehouseList;//仓库

    @TableField(exist = false)
   private WmIssueLine issueLine;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Inventory other = (Inventory) that;
        return (this.getMaterialProductId() == null ? other.getMaterialProductId() == null : this.getMaterialProductId().equals(other.getMaterialProductId()))
            && (this.getMaterialProductCode() == null ? other.getMaterialProductCode() == null : this.getMaterialProductCode().equals(other.getMaterialProductCode()))
            && (this.getMaterialProductName() == null ? other.getMaterialProductName() == null : this.getMaterialProductName().equals(other.getMaterialProductName()))
            && (this.getSpecificationAndModel() == null ? other.getSpecificationAndModel() == null : this.getSpecificationAndModel().equals(other.getSpecificationAndModel()))
            && (this.getInventoryQuantity() == null ? other.getInventoryQuantity() == null : this.getInventoryQuantity().equals(other.getInventoryQuantity()))
            && (this.getUnitId() == null ? other.getUnitId() == null : this.getUnitId().equals(other.getUnitId()))
            && (this.getInboundBatchNumber() == null ? other.getInboundBatchNumber() == null : this.getInboundBatchNumber().equals(other.getInboundBatchNumber()))
            && (this.getWarehouseCode() == null ? other.getWarehouseCode() == null : this.getWarehouseCode().equals(other.getWarehouseCode()))
            && (this.getWarehouseAreaCode() == null ? other.getWarehouseAreaCode() == null : this.getWarehouseAreaCode().equals(other.getWarehouseAreaCode()))
            && (this.getWarehouseLocationCode() == null ? other.getWarehouseLocationCode() == null : this.getWarehouseLocationCode().equals(other.getWarehouseLocationCode()))
            && (this.getSupplierCode() == null ? other.getSupplierCode() == null : this.getSupplierCode().equals(other.getSupplierCode()))
            && (this.getSupplierName() == null ? other.getSupplierName() == null : this.getSupplierName().equals(other.getSupplierName()))
            && (this.getSupplierAbbreviation() == null ? other.getSupplierAbbreviation() == null : this.getSupplierAbbreviation().equals(other.getSupplierAbbreviation()))
            && (this.getProductionOrder() == null ? other.getProductionOrder() == null : this.getProductionOrder().equals(other.getProductionOrder()))
            && (this.getIndate() == null ? other.getIndate() == null : this.getIndate().equals(other.getIndate()))
            && (this.getValidityPeriodOfInventory() == null ? other.getValidityPeriodOfInventory() == null : this.getValidityPeriodOfInventory().equals(other.getValidityPeriodOfInventory()));
    }

}